package com.kwok.mybatis.dao;

import com.kwok.mybatis.entity.Person;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface PersonDao {

    List<Person> selectPersonList();

    Person selectPersonById(Integer id);

    List<Person> selectPersonByName(String name);

//    Person selectPersonByNameAndAge(@Param("name") String name, @Param("age") Integer age);

    List<Person> selectPersonByNameAndAge(String name, Integer age);

    List<Person> selectPersonByLastName(String lastName);

    List<Person> selectByMap(Map<String, Object> map);

    Integer insertPerson(Person person);

    Integer updatePerson(Person person);

    Integer deletePersonById(Integer id);

    //批量删除参数为数组或者可变长参数都可
    Integer deletePersonByIds(Integer... ids);
    //Integer deletePersonByIds(Integer[] ids);

    //插入后返回自增主键
    Integer insertPersonByPrimaryKey(Person person);

    //批量添加
    Integer insertPersonList(List<Person> personList);

}
